/**
 * Copyright (c) 2024-2025 National Fundamental Software of China Co., Ltd.
 *
 * You should have find a copy of NFSChina License. If not, please contact us
 * by email <os_support@nfschina>
 *
**/

#ifndef SYSTEMINFOWIDGET_H
#define SYSTEMINFOWIDGET_H

#include "ui_systeminfowidget.h"

#include <QWidget>
#include <kcmodule.h>
#include <QString>
#include <string>
#include <com_nfs_license_info.h>
#include <com_nfs_devicemanager.h>

namespace Ui {
class SystemInfoWidget;
}

struct SysInfo {
    QString deviceName;
    QString osName;
    QString version;

    QString kernel;
    QString memory;
    QString CPU;
    QString GPU;
    QString type;
    QString installTime;

    QString licenseType = "os";

    bool initialized = false;
};

enum Activation_State
{
    NonActivation = 0,//未激活
    BeenActivation,//已授权
    AuthorizationExpires,//授权已过期
    ProbationaryAuthorization,//试用期已授权
    TrialExpires//试用期已过期
};

class SystemInfoWidget : public KCModule, public Ui_SystemInfoWidget
{
    Q_OBJECT

public:
    explicit SystemInfoWidget(QWidget *parent, const QVariantList &args);
    ~SystemInfoWidget() override;

    void resetUI();
    void load() override;
    void save() override;
    void defaults() override;

private slots:
    void updateLicenseState(uint state);
    void onRenamed(QString name);

 private:
    void getOsSysInfo();
    QString getExecResult(QString cmd);

    SysInfo m_sysInfo;
    com::nfs::license::Info *m_license;
};

#endif // SYSTEMINFOWIDGET_H
